import http from '@/http/http'
import { AddTagModel, TagListParam, TagParam } from './TagModel'

enum Api {
    getTagList = '/api/v1/tag/getList',
    getSort = '/api/v1/tag/getSort',
    addAndEditAndDel = '/api/v1/tag/tag',
    getSelectTagList = '/api/v1/tag/getSelectTagList'
}

// 获取文章标签列表
export const getTagTableApi = async (param: TagListParam) => {
    return await http.get(Api.getTagList, param)
}

// 获得标签sort最大值
export const getTagSortApi = async () => {
    return await http.getRestApi(Api.getSort)
}

// 获取标签数据
export const getSelectTagListApi = async () => {
    return await http.get(Api.getSelectTagList)
}

// 新增
export const addTagApi = async (param: AddTagModel) => {
    return await http.post(Api.addAndEditAndDel, param)
}
// 编辑
export const editTagApi = async (param: AddTagModel) => {
    return await http.put(Api.addAndEditAndDel, param)
}
// 删除
export const delTagApi = async (param: TagParam) => {
    return await http.delete(Api.addAndEditAndDel, param)
}
